﻿using System;
using Fee.Orders;

namespace Fee
{
    public class ConstructionTaskPlanCost : PlanCost
    {
        public ProcessInfo ProcessInfo { get; set; } = new ProcessInfo();
        public int TaskId { get; set; }

        public void UpdateBy(BudgetOrderPlanCost budgetOrderDetail)
        {
            if (budgetOrderDetail.Type != Type)
                throw new ArgumentOutOfRangeException(nameof(budgetOrderDetail), "ConstructionType 不相同，因此不能更新");
            if (budgetOrderDetail == null) throw new ArgumentNullException(nameof(budgetOrderDetail));
            FirstPartyMeteria = budgetOrderDetail.FirstPartyMeteria;

            Construction = budgetOrderDetail.Construction;
            Supervisor = budgetOrderDetail.Supervisor;
            Design = budgetOrderDetail.Design;
            TotalAmount = budgetOrderDetail.TotalAmount;
            Type = budgetOrderDetail.Type;
            ConstructionEffect = budgetOrderDetail.ConstructionEffect;
            DesignEffect = budgetOrderDetail.DesignEffect;
            SupervisorEffect = budgetOrderDetail.SupervisorEffect;
        }

        public void UpdateBy(FormalOrderPlanCost budgetOrderDetail)
        {
            if (budgetOrderDetail.Type != Type)
                throw new ArgumentOutOfRangeException(nameof(budgetOrderDetail), "ConstructionType 不相同，因此不能更新");
            if (budgetOrderDetail == null) throw new ArgumentNullException(nameof(budgetOrderDetail));
            FirstPartyMeteria = budgetOrderDetail.FirstPartyMeteria;

            Construction = budgetOrderDetail.Construction;
            Supervisor = budgetOrderDetail.Supervisor;
            Design = budgetOrderDetail.Design;
            TotalAmount = budgetOrderDetail.TotalAmount;
            Type = budgetOrderDetail.Type;
            ConstructionEffect = budgetOrderDetail.ConstructionEffect;
            DesignEffect = budgetOrderDetail.DesignEffect;
            SupervisorEffect = budgetOrderDetail.SupervisorEffect;
        }
    }
}